# -*- coding: utf-8 -*-
import json
import re
import sys
import time,datetime
import pandas as pd
import math
from dateutil import rrule
from dateutil.relativedelta import relativedelta

'''eof
name:申请人征信状态校验
code:R71_CreStatusCheck
tableName:
columnName:
groups:个人征信校验
dependencies:I
C_DSJ_2D
type:常用指标
datasourceType:在线指标
description:
eof'''

import sys
reload(sys)
sys.setdefaultencoding('utf-8')

null_type_list = ['', ' ', None, 'null', 'Null', 'NULL', '/', '-', '--']

def getTable(data, tableName, occurTimes):
    '''
        获取表信息
        :param data:表上层的字典对象
        :param tableName:表的名字
        :param occurTimes:表出现的次数，如果是0代表此表可以不出现，如果是1代表此表必须出现
        :return:该表全部数据
        '''
    table = data.get(tableName)
    if occurTimes == 0:
        if table is None or table == "":
            return [{}]
        elif isinstance(table, list) is False or len(table) == 0:
            return None
        else:
            return data.get(tableName)
    if occurTimes == 1:
        if table == "":
            return [{}]
        if table is None or isinstance(table, list) is False or len(table) == 0:
            return None
        elif len(table) == 0:
            return [{}]
        else:
            return data.get(tableName)

# 由于plutus平台out指标 只有当返回缺失值时 才触发  故当为白户时 返回缺失值

def R71_CreStatusCheck():

    extendParams = IC_DSJ_2D['extendParams']
    status = extendParams['status']

    if status==u'000007':
        return 1
    else:
        return 0


result =R71_CreStatusCheck()

if __name__ == '__main__':
    # 下面添加需要执行的函数
    # 读取json文件
    file_obj = open(r'E:\\IC_DSJ_2D.json', 'r')
    content = file_obj.read()
    # TX_CQ_DSJ= json.loads(content).get("TX_CQ_DSJ")
    IC_DSJ_2D = json.loads(content)
    # print("TX_CQ_DSJ ",TX_CQ_DSJ)

    result = R71_CreStatusCheck(IC_DSJ_2D)
    print("result = ",result)